// pages/my/my.js
const app = getApp()
Page({

	/**
	 * 页面的初始数据
	 */
  data: {
    avatarUrl: './user-unlogin.png',
    userInfo: {},
    logged: false,
    takeSession: false,
    userid: '',
    nickName: ''
  },
  onLoad: function () {
    var userInfo = app.getUserInfo();
    this.setData({
      avatarUrl: userInfo.avatarUrl,
      nickName: userInfo.nickName
    })
  },
  onshow: function () {

  },
  openSetting: function () {
    wx.openSetting({
      success(res) {
        console.log(res.authSetting)
        // res.authSetting = {
        //   "scope.userInfo": true,
        //   "scope.userLocation": true
        // }
      }
    })
  },
  getUserInfo: function (e) {
    // 获取用户信息
    console.log(e)
    var userInfo = e.detail.userInfo;
    this.setData({
      avatarUrl: userInfo.avatarUrl,
      nickName: userInfo.nickName
    })
  }

})